//
//  GGTTeamBuyDetailTableViewCell.m
//  GGT
//
//  Created by 空空空 on 14/10/29.
//  Copyright (c) 2014年 GGT. All rights reserved.
//

#import "GGTTeamBuyDetailTableViewCell.h"
@implementation GGTTeamBuyDetailTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        self.userNicknameLable = [[UILabel alloc]init];
        [self.contentView addSubview:self.userNicknameLable];
        //self.descriptLabel.backgroundColor = [UIColor grayColor];
        self.createdTimeLable = [[UILabel alloc]init];
        [self.contentView addSubview:self.createdTimeLable];
        self.textExcerptLable = [[UILabel alloc]init];
        [self.contentView addSubview:self.textExcerptLable];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    //用户名第一个字符
    NSString *str1 = [self.teamBuyReview.user_nickname substringToIndex:1];
    //用户名最后一个字符
    NSString *str2 = [self.teamBuyReview.user_nickname substringFromIndex:[self.teamBuyReview.user_nickname length] - 1];
    //讲第一个字符和最后一个字符拼接中间加星号
    if (self.teamBuyReview.user_nickname != nil) {
        self.userNicknameLable.text = [NSString stringWithFormat:@"%@*****%@", str1, str2];
    }
    
    self.createdTimeLable.text = self.teamBuyReview.created_time;
    self.createdTimeLable.textColor = [UIColor lightGrayColor];
    self.textExcerptLable.text = self.teamBuyReview.text_excerpt;
    self.textExcerptLable.numberOfLines = 0;
    self.userNicknameLable.frame = CGRectMake(10, 0, self.contentView.frame.size.width / 5 * 2, self.contentView.frame.size.height / 3);
    self.createdTimeLable.frame = CGRectMake(self.contentView.frame.size.width / 5 * 2, 0, self.contentView.frame.size.width / 5 * 3, self.contentView.frame.size.height / 3);
    self.textExcerptLable.frame = CGRectMake(10, self.contentView.frame.size.height / 3 - 10, self.contentView.frame.size.width - 20, self.contentView.frame.size.height / 3 * 2);
    self.textExcerptLable.numberOfLines = 0;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)dealloc
{
    [_createdTimeLable release];
    [_userNicknameLable release];
    [_textExcerptLable release];
    [super dealloc];
}
@end
